package cn.com.hiocde.myresume.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

import cn.com.hiocde.myresume.fragment.BaseInfoFragment;
import cn.com.hiocde.myresume.fragment.ShowPlatformFragment;
import cn.com.hiocde.myresume.fragment.MoreInfoFragment;

/**
 * Created by Hmqi on 2016/5/31.
 */
public class HomeFragmentPagerAdapter extends FragmentPagerAdapter{

    ArrayList<Fragment> frag_list=new ArrayList<Fragment>();
    ArrayList<String> tabs=new ArrayList<String>();

    public HomeFragmentPagerAdapter(FragmentManager fm){
        super(fm);

        frag_list.add(new BaseInfoFragment());
        frag_list.add(new MoreInfoFragment());
        frag_list.add(new ShowPlatformFragment());

        tabs.add("Me");
        tabs.add("More");
        tabs.add("Weibo");
    }

    public HomeFragmentPagerAdapter(FragmentManager fm,ArrayList<Fragment> frag_list , ArrayList<String> tabs) {
        super(fm);
        this.frag_list = frag_list;
        this.tabs=tabs;
    }


    @Override
    public int getCount() {
        return frag_list.size();
    }

    @Override
    public Fragment getItem(int index) {
        return frag_list.get(index);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return tabs.get(position);
    }
}
